﻿using System;
using System.Web.Mvc;

namespace WebShop.Infrastructure
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
    public class AdminOnlyAttribute : AuthorizeAttribute
    {
        public AdminOnlyAttribute()
        {
            var authorizedRoles = new[] { Constants.ROLE_ADMIN };
            Roles = string.Join(",", authorizedRoles);
        }
    }
}